<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>信息集管理</title>
<script type="text/javascript">
	
	var ligergrid = null;
	
    $(function ()
    {
        ligergrid = $("#maingrid").ligerGrid({
            columns: [
              { display: '表名', name: 'tableName', width:'25%'},
              { display: '中文表名', name: 'chineseName', width:'25%'},
              { display: '表类型', name: 'typeName', width:'20%'},
              {
                  display: '操作', isAllowHide: false,width:'30%',
                  render: function (row)
                  {
                	  var myDate = new Date();
                	  var myYear = myDate.getFullYear();
                      var html = '';
                    	  html += '<a href="#" onclick="editSet(\'' + row.id + '\')" class="update-btn">编辑</a>||';
                    	  html += '<a href="#" onclick="deleteSet(\'' + row.id + '\')" class="update-btn">删除</a>';
  
                      return String.format(html,row.annualId);
                  }
              }

            ],
            url: '${ctx}/set/tableData',
            pageSize: 10, sortName: 'orderId',
            width: '99%', height: '96%', rownumbers:true,
            pageParmName:'pageNum',
            pagesizeParmName:'pageSize',
            sortnameParmName:'sortname',
            sortorderParmName:'sortorder',
            alternatingRow:true,
        });
    });
    
    function onNewWin(){
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '新增新表',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: [($(window).height() / 20)+'px',''],
		    area: ['800px', '400px'],
		    iframe: {src: '${ctx}/set/input'}
		}); 
	}
    function search(){
    	var tableName=$("#tableName").val();
    	$.ajax({
			url:'${ctx}/set/search/'+tableName,
			type:'POST',
			cache:false,
			success:function(data){
				location.reload();
			}
		});
    }
    function editSet(id){
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '信息集修改',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: [($(window).height() / 20)+'px',''],
		    area: ['800px', '400px'],
		    iframe: {src: '${ctx}/set/edit/'+id}
		}); 
		//$.ligerDialog.open({ url: '${ctx}/userAction/preCreate', width: 800,height:350,modal:true,title:'新增人员信息'});
	}
    function editItem(id){
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '信息项修改',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: [($(window).height() / 20)+'px',''],
		    area: ['800px', '600px'],
		    iframe: {src: '${ctx}/dataSet/edit/'+id}
		}); 
		//$.ligerDialog.open({ url: '${ctx}/userAction/preCreate', width: 800,height:350,modal:true,title:'新增人员信息'});
	}
    
    function deleteSet(id){
		layer.confirm('是否删除',function(){
			$.ajax({
				url:'${ctx}/set/delete/'+id,
				type:'POST',
				cache:false,
				success:function(data){
					if(data == 'success'){
						layer.alert('操作成功',9);
						//$.ligerDialog.success('操作成功');
						location.reload();
					}else{
						layer.alert('操作失败');
						//$.ligerDialog.error('操作失败');
					}
				}
			});
		});
	}
    
    function f_query(){
		ligergrid.set('parms',$('#form1').serializeArray());
		ligergrid.loadData();
	}
</script>
</head>
<body>
<div id="searchbar" style="margin:5px;">
	<form name="form1" method="get"  id="form1" class="form-horizontal">
		<div class="control-group">
			<div class="controls">
				<table>
					<tr>
						<td class="controls">
							<label class="control-label" for="report_type">中文名称：</label>
							<input id="chineseName" name="filter_LIKES_chineseName" type="text" value="${param['filter_LIKES_chineseName']}" />
						</td>
						<td class="controls">
							<input type="button" class="btn btn-info" value="查询" onclick="f_query();" />
							<button class="btn btn-info" onclick="javascript:chineseName.value=''">清空</button>
							<input type="button" class="btn btn-info" value="新增表" onclick="onNewWin();" />
						</td>
					</tr>
				</table>
			</div>
		</div>
	</form>
</div>
	<div id="maingrid" style="margin:5px; padding:0;height:90%"></div>
	<div style="display:none;"></div>
</body>
</html>